#include "ClientSocket.h" #include "SocketException.h" #include #include int main ( int argc, int argv[] ) { try { ClientSocket client_socket ( "localhost", 4000 ); std::string reply; char msg[1000]; while(1) { try { cin >> msg; client_socket << msg; client_socket << "\n"; client_socket >> reply; std::cout << "echo: " << reply; if (strcmp(msg,"end") == 0) break; } catch ( SocketException& ) {} } } catch ( SocketException& e ) { std::cout << "Exception was caught:" << e.description() << "\n"; } return 0; }